import allure

from page_element.roncoo_power_manage import operator
from page_object.roncoo_login import RoncooLogin
from page_element.el_A3mall import *
import logging
from utils.timer import sleep



class Add_Operator(RoncooLogin):
    """添加操作员"""

    def page_add_operator_login(self, info1,info2,info3,info4,value,info5):
        # 前置条件：已登录
        self.roncoo_login()
        with allure.step(f"点击权限管理"):
            self.click(operator.power_manage)
            sleep(2)
        with allure.step(f"点击操作员管理"):
            self.click(operator.operator_manage)
            sleep(20)
        with allure.step(f"输入操作员姓名"):
            self.send_keys(operator.operator_name,info1)
            sleep(2)
        with allure.step(f"输入操作员登录姓名"):
            self.send_keys(operator.operator_login_name,info2)
            sleep(2)
        with allure.step(f"输入密码"):
            self.send_keys(operator.password,info3)
            sleep(2)
        with allure.step(f"输入手机号"):
            self.send_keys(operator.phone,info4)
            sleep(2)
        with allure.step(f"选择状态"):
            self.select_by_value(operator.required,value)
            sleep(2)
        with allure.step(f"输入描述"):
            self.send_keys(operator.desc,info5)
            sleep(2)
        with allure.step(f"点击角色"):
            self.click(operator.role)
            sleep(2)
        with allure.step(f"选择状态"):
            self.click(operator.submit)
            sleep(2)
